﻿using HandyControl.Controls;
using HandyControl.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Timers;
using System.Windows.Threading;
using WWLauncher.View.Other;
using WWLauncher.ViewModel;

namespace WWLauncher.Tasks
{
    public class ToDoTask
    {

        public static Dictionary<ToDoViewModel, Notification> activityBacklog = new();

        public static void BackLogCheck()
        {

            System.Timers.Timer timer = new System.Timers.Timer
            {
                Enabled = true,
                Interval = 5000
            };
            timer.Start();
            timer.Elapsed += new System.Timers.ElapsedEventHandler(Check);
        }


        private static void Check(object source, ElapsedEventArgs e)
        {
            //App.Current.Dispatcher.Invoke(() =>
            //{
            //    try
            //    {
            //        if (MainViewModel.Instance().ToDoList.Any())
            //        {
            //            string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            //            var exeBacklogList = MainViewModel.Instance().ToDoList;
            //            foreach (var info in exeBacklogList)
            //            {
            //                if (info.ExeTime.CompareTo(nowTime) == -1 && !activityBacklog.ContainsKey(info))
            //                {
            //                    activityBacklog.Add(info, Notification.Show(new BacklogNotificatin(info), ShowAnimation.Fade, true));
            //                }
            //            }
            //        }
            //    }
            //    catch { }
            //});
        }

 

    }
}
